package org.lixf.io.scanner;

import java.io.*;
import java.util.Scanner;

public class ScannerTest {
    public static void main(String[] args) throws Exception {
        // test01();
        // test02();
        // test03();
        test04();
        // System.setOut 重置标准输出流到文件
        System.out.println("2222222222222");
    }

    static void test01() {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        System.out.println(s);
    }

    static void test02() throws FileNotFoundException {
        Scanner scanner = new Scanner(new FileInputStream("src/main/java/org/lixf/io/scanner/test.txt"));
        String s = scanner.nextLine();
        System.out.println(s);
    }

    static void test03() throws IOException {
        BufferedReader is = new BufferedReader(new InputStreamReader(System.in));
        String s = is.readLine();
        System.out.println(s);
    }

    static void test04() throws FileNotFoundException {
        System.setOut(new PrintStream(new FileOutputStream("src/main/java/org/lixf/io/scanner/test.txt")));
        System.out.println("aaaaaabbbbbbbb");
    }

}